from datetime import datetime

import toml

COMMON_DATE_FMT = "%Y-%m-%d %H:%M:%S"
YEAR_MONTH_DAY_DATE_FMT = "%Y-%m-%d"
default_cfg_file = "./fahuo.toml"


class TomlCfg(object):
    def __init__(self):
        self.conf = {}

    def __getitem__(self, item):
        return self.conf.get(item, None)

    def load(self, cfg_file=default_cfg_file):
        toml_conf = toml.load(cfg_file)
        cfg.conf = toml_conf


cfg = TomlCfg()
